package com.fahai.utils;

/**
 * 通用工具类
 */
public class CommonUtil {

    /***
     * 字符串首字母大写
     * @param str
     * @return
     */
    public static String upperCaseFirst(String str) {
        str =str.replaceFirst(str.substring(0, 1),str.substring(0, 1).toUpperCase()) ;
        return str;
    }

    /**
     * 根据call_status , reject_status 翻译成对应的状态
     * @param callStatus
     * @param rejectStatus 空 转换成 0
     * @return
     * @version 2.0
     */
    public  static String  parseThjg(Integer callStatus, Integer rejectStatus){
        if(null==callStatus)
            return "";
        switch (callStatus) {
            case 1:
                return (rejectStatus == 1 ? "主叫方" : "被叫方") + "挂断";
            case 2:
                return (rejectStatus == 1 ? "主叫方" : "被叫方") + "未接通";
            case 3:
                return (rejectStatus == 1 ? "主叫方" : "被叫方") + "拒接";
            case 4:
                return "拨打失败";
            case 5:
                return "异常状态";
        }




//        case 1:
//        return (reject_state == 1 ? '主叫方' : '被叫方') + '挂断';
//        case 2:
//        return (reject_state == 1 ? '主叫方' : '被叫方') + '未接通';
//        case 3:
//        return (reject_state == 1 ? '主叫方' : '被叫方') + '拒接';

        return "";
    }

}
